package com.coderknock.bbs

import com.alibaba.fastjson.JSON
import com.coderknock.bbs.mybatis.dao.UserDao
import org.junit.Test
import org.junit.runner.RunWith
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.test.context.SpringBootTest
import org.springframework.mail.MailSender
import org.springframework.mail.SimpleMailMessage
import org.springframework.test.context.junit4.SpringRunner

@RunWith(SpringRunner::class)
@SpringBootTest
class CoderknockBbsApplicationTests {

    @Autowired
    var userDao: UserDao? = null
    @Autowired
    var mailSender: MailSender? = null

    @Test
    fun contextLoads() {
//        println(JSON.toJSONString(userDao!!.findAll()))
        var msg = SimpleMailMessage()
        msg.from="sanchan@coderknock.com"
        msg.subject="主题"
        msg.setTo("792141800@qq.com")
        msg.text = "test 测试发送hljm"
        mailSender!!.send(msg)
    }

}
